<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>手机机型管理 | 手机机型列表</title>
<@fm.header />
<script>
function doSearch(){    
    $('#tt').datagrid('load', {    
        hsman: $('#hsman').val()
    });
}
function add(){
    showMyWindow('手机机型管理 | 新建手机机型', '/device/add', 400, 350);
}
function edit(){
	var row = $('#tt').datagrid('getSelected');
    if (row){
	    showMyWindow('手机机型管理 | 编辑手机机型', '/device/'+row.id+'/update', 400, 350);
    } else {
    	showMsg(market.content.title, market.content.tips, alert);
    }
}

function del() {
	var recordArr =$('#tt').datagrid('getChecked');
	if(recordArr==undefined||recordArr==null||recordArr.length==0){
		$.messager.alert("提示", "请先选择记录");
		return;
	}
	var uuidArr=new Array();
	for(var i=0;i<recordArr.length;i++){
		uuidArr[i]=recordArr[i].id;
	}
	 uuids=uuidArr.join(",");
	 showConfirm(market.content.title, market.content.confirm, function(){
		  $.post('/device/'+uuids+'/delete', function(data) {
		  	if (data.return_code == '1') {
				top.showMsg(market.content.title, data.return_msg, alert);
				$("#tt").datagrid('reload');
			} else {
				$.messager.alert(market.content.title, data.return_msg);
			}
		  });
	   });
	 $("#tt").datagrid('reload');
	 $('#tt').datagrid('clearSelections');
}
</script>
</head>
<body class="cmp-list-body">
<div id="tb" style="padding:3px">
    <span>手机机型:</span>
    <input id="hsman" style="line-height:20px;border:1px solid #ccc">
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearch();">查询</a> 
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add();">新增</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del();">删除</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit();">修改</a>
</div>
<table id="tt" class="easyui-datagrid" title="手机机型管理 | 手机机型列表" iconCls="icon-save" 
	url="/device/list?json" toolbar="#tb" rownumbers="true" idField="id"
	selectOnCheck="true" pagination="true" fitColumns="true" pageSize="15" pageList="[15,30,60,80,100]"> 
    <thead>
        <tr>
       	   <th data-options="field:'ck',checkbox:true"></th>
            <th align="center" width="20%" field="hsman">hsman</th>
            <th align="center" width="30%" field="hstype">hstype</th>
            <th align="center" width="20%" field="createTime">创建时间</th>
        </tr>
    </thead>   
</table>
</body>
</html>